﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserForm.aspx.cs" Inherits="FX.CC.Andon.WebSite.CommForm.UserForm" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="../lib/boot.js" type="text/javascript"></script>
</head>
<body>
    <div class="mini-toolbar" style="padding: 2px;" borderstyle="border:0;">
        <table>
            <tr>
                <td style="width: 100px;" align="right">
                    登录账号：
                </td>
                <td style="width: 150px;" align="left">
                    <input id="aLoginCode" class="mini-textbox" emptytext="请输入登录账号" style="width: 150px;"
                        onenter="onKeyEnter" />
                </td>
                <td style="width: 100px;" align="right">
                    职员姓名：
                </td>
                <td style="width: 150px;" align="left">
                    <input id="FullName" class="mini-textbox" emptytext="请输入姓名" style="width: 150px;"
                        onenter="onKeyEnter" />
                </td>
                <td style="width: 100px;" align="right">
                    手机号码：
                </td>
                <td style="width: 150px;" align="left">
                    <input id="MobileNo" class="mini-textbox" emptytext="请输入手机号码" style="width: 150px;"
                        onenter="onKeyEnter" />
                </td>
                <td style="width: 100px">
                    <a class="mini-button" iconcls="icon-search" onclick="search()">查 询</a>
                </td>
            </tr>
            <tr>
                <td style="width: 100px;" align="right">
                    角色：
                </td>
                <td style="width: 150px;" align="left">
                    <input id="Role" class="mini-combobox" style="width: 150px;" textfield="RoleName"
                        valuefield="RoleID" shownullitem="true" allowinput="true" />
                </td>
                <td style="width: 100px;" align="right">
                    部门：
                </td>
                <td style="width: 150px;" align="left">
                    <input id="Dept" class="mini-combobox" style="width: 150px;" textfield="DptName"
                        valuefield="DptID" shownullitem="true" allowinput="false" />
                </td>
                <td style="width: 100px;" align="right">
                    状态：
                </td>
                <td style="width: 150px;" align="left">
                    <input id="RecStatus" name="RecStatus" shownullitem="true" allowinput="true" style="width: 150px;"
                        class="mini-combobox" textfield="text" valuefield="id" data="RecStatusData" />
                </td>
                <td style="width: 100px">
                    <a class="mini-button" iconcls="icon-reset" onclick="reset()">重 置</a>
                </td>
            </tr>
        </table>
    </div>
    <!--撑满页面-->
    <div class="mini-fit">
        <div id="datagrid1" class="mini-datagrid" style="width: 100%; height: 100%; border-left: 0px;
            border-right: 0px;" idfield="UserID" sizelist="[10,20,50,100]" pagesize="10"
            multiselect="true" onrowdblclick="ondoubleclick()">
            <div property="columns">
                <div type="checkcolumn">
                </div>
                <div field="RecStatus" width="50" headeralign="center" allowsort="true" renderer="onRecStatusRenderer">
                    状态
                </div>
                <div field="LoginCode" width="120" headeralign="center" allowsort="true">
                    登录账号
                </div>
                <div field="FullName" width="120" headeralign="center" allowsort="true">
                    职员姓名
                </div>
                <div field="MobileNo" width="100" headeralign="center" allowsort="true">
                    手机号码
                </div>
                <div field="RoleName" width="100" headeralign="center" allowsort="true">
                    角色
                </div>
                <div field="DptName" width="100" headeralign="center" allowsort="true">
                    部门
                </div>
                <div field="Desc" width="180" headeralign="center" allowsort="false">
                    描述
                </div>
            </div>
        </div>
    </div>
    <div class="mini-toolbar" style="text-align: center; padding-top: 8px; padding-bottom: 8px;"
        borderstyle="border:0;">
        <a class="mini-button" iconcls="icon-ok" style="width: 60px;" onclick="onOk()">确定</a>
        <span style="display: inline-block; width: 25px;"></span><a class="mini-button" iconcls="icon-cancel"
            style="width: 60px;" onclick="onCancel()">取消</a>
    </div>
    <script type="text/javascript">
        var RecStatusData = [{ id: 0, text: '已锁定' }, { id: 1, text: '未锁定'}];
        mini.parse();
        var role = mini.get("Role");
        var dept = mini.get("Dept");
        var grid = mini.get("datagrid1");
        role.setUrl("../Service/PublicHandler.ashx?action=GetRoleList");
        dept.setUrl("../Service/PublicHandler.ashx?action=GetDeptList");
        grid.setUrl("../Service/SystemManageHandler.ashx?action=GetUserList");
        grid.load();
        function search() {
            var aLoginCode = mini.get("aLoginCode").getValue();
            var fullName = mini.get("FullName").getValue();
            var MobileNo = mini.get("MobileNo").getValue();
            var roleID = mini.get("Role").getValue();
            var dptID = mini.get("Dept").getValue();
            var recStatus = mini.get("RecStatus").getValue();
            grid.load({ aLoginCode: aLoginCode, FullName: fullName, MobileNo: MobileNo, RoleID: roleID, DptID: dptID, RecStatus: recStatus });
        }
        function onKeyEnter(e) {
            search();
        }
        function reset(e) {
            mini.get("aLoginCode").setValue("");
            mini.get("FullName").setValue("");
            mini.get("MobileNo").setValue("");
            mini.get("Role").setValue("");
            mini.get("Dept").setValue("");
            mini.get("RecStatus").setValue("");
        }
        function GetData() {
            var rows = grid.getSelecteds();
            var data = [];
            for (var i = 0, l = rows.length; i < l; i++) {
                var row = rows[i];
                data.push(row);
            }
            return data;
        }
        function ondoubleclick() {
            onOk();
        }
        function onOk() {
            var rows = grid.getSelecteds();
            if (rows) {
                CloseWindow("ok");
            }
            else {
                mini.alert("请选中一条您需要添加的记录!");
            }

        }
        function onRecStatusRenderer(e) {
            if (e.value == "0") { return "<span style=\"color: Red;font-weight:bold;\">已锁定</span>"; }
            else if (e.value == "1") { return "<span style=\"color: Green;font-weight:bold;\">未锁定</span>"; }
            else { return ""; }
        }

        function CloseWindow(action) {
            if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
            else window.close();
        }
        function onCancel() {
            CloseWindow("cancel");
        }
    </script>
</body>
</html>
